<%@ page language="java"   pageEncoding="utf8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />
		<link rel="stylesheet"
			href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>"
			type="text/css" />


	</head>
	<body>
		<div id="headBar" class="head_content">
			<div class="finder-action" id="">
				<div class="finder-action-inner clearfix">
					<button type="button" wrapimg="true"
						onclick="location.href='mt_giftCat_add.html'"
						class="btn btn-xl-large">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 24px; height: 24px; background-position: 0pt -316px;">
							</i>添加赠品分类</span> </span>
					</button>
					<button type="button" wrapimg="true" onclick="location.reload()"
						class="btn">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 22px; height: 24px; background-position: 0pt -644px;">
							</i>刷新</span> </span>
					</button>
					<button type="button" onclick="giftCatBatchDelete()"  class="btn">
						<span><span><i class="finder-icon"><img
										src="<c:url value="/images/transparent.gif"/>"
										class="imgbundle icon"
										style="width: 17px; height: 24px; background-position: 0pt -757px;">
							</i>删除</span> </span>
					</button>
				</div>
			</div>
			
			<div class="finder-header">
				<table cellpadding="0" cellspacing="0" width="100%">
					<!----cols---->
					<col style="width: 24px;" class="span-select">
 						<col style="width: 70px;" />
						<col style="width: 180px;" />
						<col style="width: 110px;" />
						<col style="width: 110px;" />
						<col />
						<!----cols---->
					<thead>
						<tr>
							<td>
								<input class="sellist" id="giftcat_ids"  
									type="checkbox" />
							</td> 
							<td>
								<table cellpadding="0" cellspacing="0" width="100%">
									<tbody>
										<tr>
											<td>
												<span class="finder-col-label">操作</span>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
							<td>
								<div class="cell orderable" key="cat">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">分类名称</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell orderable" key="shop_iffb">
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">是否发布</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								<div class="cell  "	 >
									<table cellpadding="0" cellspacing="0" width="100%">
										<tbody>
											<tr>
												<td>
													<span class="finder-col-label">排序</span>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
					</thead>
				</table>
			</div>
		</div>
		<div   id="main"
			class="main_content">
			<div class="finder-list finder-list-normal"  >
				<form id="gift_cat_list_form" action="mt_giftCat_delete.html" method="post">
				 
			
				<table cellpadding="0" cellspacing="0" width="100%" id="gift_cat_tbl">
					<!----cols---->
					<col style="width: 24px;" class="span-select">
 						<col style="width: 70px;" />
						<col style="width: 180px;" />
						<col style="width: 110px;" />
						<col style="width: 110px;" />
						<col />
						<!----cols---->
					<tbody>
					<c:forEach var="giftCat" items="${marketGiftCats}" varStatus="catIndex" >
					
						<tr class="row" item-id="3">
							<td>
								<input onclick="changeColor(this)"  class="sel" name="marketGiftCats[${catIndex.index}].giftCatId" value="${giftCat.giftCatId}"
									type="checkbox" />
							</td>
							 
							<td  >
								<div class="cell">
									<a href="mt_giftCat_edit.html?giftCatId=${giftCat.giftCatId}"><img
											src="<c:url value="/images/transparent.gif"/>"
											class="imgbundle"
											style="width: 15px; height: 16px; background-position: 0pt -133px;">
											编辑 
									</a>
								</div>
							</td>
							<td key="cat" class="editable">
								<div class="cell">
									${ giftCat.giftCatName}
								</div>
							</td>
							<td key="shop_iffb" class="editable">
								<div class="cell">
									 
									
											<c:if test="${giftCat.showOn}">是</c:if>
											<c:if test="${!giftCat.showOn}">否</c:if>
								</div>
							</td>
							<td key="orderlist" class="editable">
								<div class="cell">
									${ giftCat.showOrder}
								</div>
							</td>
							<td>
								&nbsp;
							</td>
						</tr>
						 </c:forEach>
					 
					</tbody>
				</table>
				</form>
				 
			</div>
			
		</div>
		<div  id="footBar" class="foot_content">
			<div class="finder-footer" id="finder-footer-ea2899">
				<div class="finder-page clearfix">
					<div class="span-3">
						 
					</div>
					<div class="span-auto"></div>
					<div class="span-auto textright">
						共<i>${fn:length(marketGiftCats)}</i>条
					</div>
				</div>
			</div>
		 
		</div>



		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>

		<%@ include file="/jsp/admin/common/messages.jsp"%>


		<script type="text/javascript">
	var selected = 'selected';
	$("#giftcat_ids").click(function() {

		if (this.checked) {
			$('input[type=checkbox]').attr("checked", true);

			$('#gift_cat_tbl >tbody> tr').addClass(selected);
		} else {
			$('input[type=checkbox]').attr("checked", false);
			$('#gift_cat_tbl > tbody > tr').removeClass(selected);
		}
	});

	function changeColor(obj) {
		if ($(obj).attr("checked")) {
			$(obj).parent().parent().addClass(selected);
		} else {
			$(obj).parent().parent().removeClass(selected);
		}
	}

	function giftCatBatchDelete() {
		var selected = false;
		$('#gift_cat_tbl input[type=checkbox]').each( function(i, dom){
			if($(dom).attr("checked")){
				selected = true;
			}							
		});	
		if(!selected){
			alert('请选择要删除的分类');
			return;
		}
		if (!confirm("确定删除吗？")) {
			return;
		}   
		$('#gift_cat_list_form').submit();
	}
</script>


	</body>


</html>

